package jannex.sql;

import jannex.JannexException;
import jannex.mapping.ResultSetHandler;
import jannex.query.QueryBuilder;

import java.sql.SQLWarning;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

public interface JxConnection extends java.sql.Connection {

    Query query(String sql) throws JannexException;

    <E> QueryBuilder<E> plan(Class<E> elementClass) throws JannexException;

    <E> QueryBuilder<E> plan(ResultSetHandler<E> handler) throws JannexException;

    <E> TypedArray<E> createArrayOf(Class<E> elementClass, E[] elements) throws JannexException;

    <E> TypedArray<E> createArrayOf(E[] elements) throws JannexException;

    @Override
    JxStatement createStatement() throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql) throws JannexException;

    @Override
    JxCallableStatement prepareCall(String sql) throws JannexException;

    @Override
    String nativeSQL(String sql) throws JannexException;

    @Override
    void setAutoCommit(boolean autoCommit) throws JannexException;

    @Override
    boolean getAutoCommit() throws JannexException;

    @Override
    void commit() throws JannexException;

    @Override
    void rollback() throws JannexException;

    @Override
    void close() throws JannexException;

    @Override
    boolean isClosed() throws JannexException;

    @Override
    JxDatabaseMetaData getMetaData() throws JannexException;

    @Override
    void setReadOnly(boolean readOnly) throws JannexException;

    @Override
    boolean isReadOnly() throws JannexException;

    @Override
    void setCatalog(String catalog) throws JannexException;

    @Override
    String getCatalog() throws JannexException;

    @Override
    void setTransactionIsolation(int level) throws JannexException;

    @Override
    int getTransactionIsolation() throws JannexException;

    @Override
    SQLWarning getWarnings() throws JannexException;

    @Override
    void clearWarnings() throws JannexException;

    @Override
    JxStatement createStatement(int resultSetType, int resultSetConcurrency) throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws JannexException;

    @Override
    JxCallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws JannexException;

    @Override
    Map<String, Class<?>> getTypeMap() throws JannexException;

    @Override
    void setTypeMap(Map<String, Class<?>> map) throws JannexException;

    @Override
    void setHoldability(int holdability) throws JannexException;

    @Override
    int getHoldability() throws JannexException;

    @Override
    JxSavepoint setSavepoint() throws JannexException;

    @Override
    JxSavepoint setSavepoint(String name) throws JannexException;

    @Override
    void rollback(java.sql.Savepoint savepoint) throws JannexException;

    @Override
    void releaseSavepoint(java.sql.Savepoint savepoint) throws JannexException;

    @Override
    JxStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
                                       int resultSetHoldability) throws JannexException;

    @Override
    JxCallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql, int[] columnIndexes) throws JannexException;

    @Override
    JxPreparedStatement prepareStatement(String sql, String[] columnNames) throws JannexException;

    @Override
    JxClob createClob() throws JannexException;

    @Override
    JxBlob createBlob() throws JannexException;

    @Override
    JxNClob createNClob() throws JannexException;

    @Override
    JxSQLXML createSQLXML() throws JannexException;

    @Override
    boolean isValid(int timeout) throws JannexException;

    @Override
    void setClientInfo(String name, String value) throws JannexException;

    @Override
    void setClientInfo(Properties properties) throws JannexException;

    @Override
    String getClientInfo(String name) throws JannexException;

    @Override
    Properties getClientInfo() throws JannexException;

    @Override
    JxArray createArrayOf(String typeName, Object[] elements) throws JannexException;

    @Override
    JxStruct createStruct(String typeName, Object[] attributes) throws JannexException;

    @Override
    void setSchema(String schema) throws JannexException;

    @Override
    String getSchema() throws JannexException;

    @Override
    void abort(Executor executor) throws JannexException;

    @Override
    void setNetworkTimeout(Executor executor, int milliseconds) throws JannexException;

    @Override
    int getNetworkTimeout() throws JannexException;

    @Override
    <T> T unwrap(Class<T> iface) throws JannexException;

    @Override
    boolean isWrapperFor(Class<?> iface) throws JannexException;

}
